All Functions Used on PO11Q

head

{utils}

Show first 5 rows of a data frame

as.character

{base}

Coerce a vector to character

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

element_text

{GGPLOT2}

Customise text in GGPLOT2

data.frame

{base}

Create a data.frame from vectors

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

mutate

{dplyr}

Modify/create a column in a data frame

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

c

{base}

Combine values/vectors into a vector

factor

{base}

Create a factor

sum

{base}

Get sum of numeric values or a vector

select

{dplyr}

Select columns from a tibble/data frame

filter

{dplyr}

Filter out rows of a data frame according to logical vector

hist

{graphics}

Plot a simple histogram

mean

{base}

Get mean of a vector

complete.cases

{stats}

Find Complete Cases

ylab

{GGPLOT2}

Label the y axis (ggplot)

ordered

{dplyr}

Create an ordered factor

min

{base}

Get minimum of a vector

labs

{GGPLOT2}

Customise labels in GGPLOT2

read_dta

{haven}

Read a .dta file (Stata data)

n

{dplyr}

The number of observations in the current group.

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

ggplot

{GGPLOT2}

Create a ggplot graph

geom_histogram

{GGPLOT2}

Generates a histogram

max

{base}

Get maximum of a vector

stat_ecdf

{GGPLOT2}

Compute empirical cumulative distribution

write_dta

NA

sample_n

{dplyr}

Sample a number of observations from a data frame

theme

{GGPLOT2}

Set theme for GGPLOT2

save

{base}

Writes an external representation of R objects to the specified file.

str

{utils}

Get the structure of an R object

geom_segment

{GGPLOT2}

Generates a line segment or curve

recode

{dplyr}

Recode a variable

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

as.numeric

{base}

Coerce a vector to numeric

ungroup

{dplyr}

Resolve grouping created with “group_by”

ecdf

{stats}

Compute an empirical cumulative distribution function

spread

{tidyr}

Spread a key-value pair across multiple columns

sqrt

{stats}

Square root

median

{stats}

Get median of a vector

summarize

NA

set.seed

{base}

Initialise a pseudorandom number generator.

read_excel

{readxl}

Read an Excel file

slice

{dplyr}

Subset rows using their positions

desc

{dplyr}

Arrange in descending order

write.csv

{utils}

write a csv file to a data frame

geom_bar

{GGPLOT2}

Generates a bar chart

levels

{base}

Get levels of a factor

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

library

{base}

Load an R package

setwd

{base}

Set Working Directory

prop.test

{stats}

Test of Equal or Given Proportions

summary

{base}

Obtain summary statistics or detailed regression output

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

with

{base}

evaluate expression in the context of a data frame

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

is.na

{base}

Check if a value is NA/elements of vector are NA

boxplot

{graphics}

Plot a simple box plot

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

cut

{base}

Convert Numeric to Factor

separate

{dplyr}

Separate a character column into multiple columns

sd

{stats}

Get standard deviation of a vector

range

{base}

Return range of values

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

var

{stats}

Calculate variance

seq

{base}

Create a sequence

names

{base}

Retrieve names of a list/vector

ifelse

{base}

Return a or b depending on the value of test

The end!